package com.example.john.foodstore;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DefaultHttpClient;

import java.util.HashMap;

public class LoginActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
    }
    public void Confirm(View v){
        new Thread(){
            public void run(){
                HttpClient client=new DefaultHttpClient();
                HttpUriRequest res=new HttpGet("http://192.168.20.169:8080/ETest/StoreLogin?username=aaa&password=123");
                //HttpUriRequest res=new HttpGet("http://www.baidu.com");
                try{
                    Log.i("Amy","2222");
                    HttpResponse rep = client.execute(res);
                    Log.i("Amy","success");
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }.start();
//        Intent intent = new Intent();
//        intent.setClass(this, OrderItemAdapter.class);
//        startActivity(intent);

    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_login, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
